package com.gridmobi.xrtb.handler.monitor;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;

public class SimpleData {
    public static Set<String> BUDGET_FULL_CAMPAIGN = Sets.newHashSet();
    public static Set<String> BUDGET_DAILY_FULL_CAMPAIGN = Sets.newHashSet();
    public static Set<String> BUDGET_ACTI_CAMPAIGN = Sets.newHashSet();
    public static Set<String> IDFAUNIQ_SET = Sets.newConcurrentHashSet();
    public static Set<String> IPUNIQ_SET = Sets.newConcurrentHashSet();
    public static Set<String> CAMPAIGNS_TARGET_COUNTRY = Sets.newConcurrentHashSet();
    public static Map<String, String> RICH_MEDIA = Maps.newHashMap();
    public static Map<String, String> CAMPAIGNS_LANDURL = Maps.newHashMap();
    public static Map<Long, Float> CAMPAIGNS_DAYLY_BUDGET_CACHE = Maps.newHashMap();
    public static Map<Long, Float> CAMPAIGNS_DAYLY_BUDGET_CACHE_WIN = Maps.newHashMap();


    public static Cache<String, Object> IDFACACHE = CacheBuilder.newBuilder()
            /*设置缓存容器的初始容量大小为10*/
            .initialCapacity(100000)
            /*设置缓存容器的最大容量大小为100*/
            .maximumSize(10000000)
            /*设置记录缓存命中率*/
            .recordStats()
            /*设置并发级别为8，智并发基本值可以同事些缓存的线程数*/
            .concurrencyLevel(32)
            /*设置过期时间为2秒*/
            .expireAfterWrite(2, TimeUnit.DAYS).build();


    public static Cache<String, Object> IPCACHE = CacheBuilder.newBuilder()
            /*设置缓存容器的初始容量大小为10*/
            .initialCapacity(1000)
            /*设置缓存容器的最大容量大小为100*/
            .maximumSize(1000000)
            /*设置记录缓存命中率*/
            .recordStats()
            /*设置并发级别为8，智并发基本值可以同事些缓存的线程数*/
            .concurrencyLevel(32)
            /*设置过期时间为2秒*/
            .expireAfterWrite(1, TimeUnit.HOURS).build();

}
